feat(api): accept ?release= as a snapshot anchor on detail reads - #8
Merged
Merged
Conversation
Pinning a past snapshot needed its scan UUID, which a caller cannot know: answering "what shipped in 4.0" meant listing releases, matching the label, then re-requesting. Fourteen detail endpoints now also take ?release=, so /notice?release=4.0 is a permanent address for a version. Resolved once in a shared FastAPI dependency rather than threaded through fourteen endpoints and the services behind them — the translation is the same everywhere, and the services keep their scan-id contract. scan_id wins when both are given; an unknown label 404s exactly like an unusable id.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pinning a past snapshot required its scan UUID, which a caller has no way to know in advance. Answering "what shipped in 4.0" meant listing releases, matching the label client-side, then re-requesting with the id — two round-trips, and no URL you could write down. The fourteen detail endpoints now also accept
?release=4.0, so/notice?release=4.0is a permanent address for a version. It works because a label identifies exactly one live snapshot (#4).The label is resolved once in a shared FastAPI dependency, not threaded through fourteen endpoints and the ten services behind them. The translation — turn a label into the scan id the endpoint already handles — is identical everywhere, so putting it in fourteen places would only multiply the chances of the precedence rule drifting. Services keep their existing
snapshot_scan_idcontract and never learn labels exist.scan_idwins when both are given: it names one immutable snapshot, while a label names whichever snapshot currently holds it, and the more specific should not be overridden by the looser. An unknown label returns the same existence-hiding404an unusablescan_idgets, so neither reveals whether the other exists — that needed aSnapshotScanNotFoundhandler incore.errors, since a dependency raises before the routers' local try/except.The anchor follows a moved label: rescanning 4.0 supersedes the earlier claim, and
?release=4.0resolves to the winner rather than the snapshot that used to hold it. Covered by a test, along with cross-project isolation and the precedence rule.Third and last of the follow-ups after #6 and #7. Nine local test failures are all reproducible on
main(accumulated rows in my dev database).